package com.nforce.linremote;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;

public class ProgramDetailActivity extends FragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_program_detail);

	getActionBar().setDisplayHomeAsUpEnabled(true);

	if (savedInstanceState == null) {
	    ProgramDetailFragment fragment = new ProgramDetailFragment();
	    fragment.setArguments(getIntent().getExtras());
	    getSupportFragmentManager().beginTransaction()
		    .add(R.id.program_detail_container, fragment).commit();
	}
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
	switch (item.getItemId()) {
	case android.R.id.home:
	    NavUtils.navigateUpTo(this, new Intent(this,
		    ProgramListActivity.class));
	    return true;
	}
	return super.onOptionsItemSelected(item);
    }
}
